ARG N_V=18.20.8
FROM registry.cn-hangzhou.aliyuncs.com/xiaoyilin/nodejs:${N_V}
# 安装TypeScript
ARG TS_V=5.9.3
# 编译器
RUN  npm install typescript@${TS_V} -g --registry=https://registry.npmmirror.com
CMD ["tsc","-V"]

# 创建TypeScript项目工作目录
# mkdir -p ~/ts/project
# 进入TypeScript项目工作目录
# cd ~/ts/project
# 初始化TypeScript项目
# tsc --init
# 编写代码(创建index.ts文件)
#TypeScript项目配置文件tsconfig.json

# https://www.typescriptlang.org/zh/docs/
# docker build --build-arg N_V=18.20.8 --build-arg TS_V=5.9.3 -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/ts:5.9.3-n18 .
# docker build --build-arg N_V=20.19.5 --build-arg TS_V=5.9.3 -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/ts:5.9.3-n20 .
# docker build --build-arg N_V=22.21.1 --build-arg TS_V=5.9.3 -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/ts:5.9.3-n22 .
# docker build --build-arg N_V=24.11.1 --build-arg TS_V=5.9.3 -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/ts:5.9.3-n24 .
# docker push registry.cn-hangzhou.aliyuncs.com/xiaoyilin/ts:5.9.3-n18
# docker push registry.cn-hangzhou.aliyuncs.com/xiaoyilin/ts:5.9.3-n20
# docker push registry.cn-hangzhou.aliyuncs.com/xiaoyilin/ts:5.9.3-n22
# docker push registry.cn-hangzhou.aliyuncs.com/xiaoyilin/ts:5.9.3-n24
# docker run --rm registry.cn-hangzhou.aliyuncs.com/xiaoyilin/ts:5.9.3-n18
# docker run --rm -it -v /mnt/d/wsl/ts/project:/home/ts/project registry.cn-hangzhou.aliyuncs.com/xiaoyilin/ts:5.9.3-n18 bash

# TypeScript转换JavaScript
# tsc index.ts
# node index.js